<?php session_start();

if($_SESSION['login'] == ""){
    echo "<meta HTTP-EQUIV='Refresh' CONTENT='0;URL=/Esquina_da_TI/GUI/EfetuarLogin.php'>";
}

require_once($_SERVER["DOCUMENT_ROOT"] . '/Esquina_da_TI/Gui/Fachada.php');

if($_SESSION['ultimaAcaoMinhaConta'] != "CANCELARCONTA") {
    unset($_SESSION["menssagemErro"]);
}


$menssagemErro = $_SESSION["menssagemErro"];
?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link href="/Esquina_da_TI/default.css" rel="stylesheet" type="text/css" media="screen" />
        <script type="text/javascript" src="formulario.js"></script>
        <title>Meus Tópicos</title>
    </head>
    <body>
        <center>
            <h1>Meus Tópicos</h1>
            <form id="formularioMeusPost" name="formularioMeus Posts" method="POST" action="">
                <input type="hidden" id="action" name="action">

                    <table  border="2" cellspacing="1" cellpadding="1">
                        <tr>
                            <td class="head" colspan="3">Controle de Tópicos</td>
                        </tr>
                        <tr>
                            <td class="responder">Data</td><td class="responder">Tópico</td><td class="responder">Respostas</td>
                            <?
                            $fachada = new Fachada();

                            $meusTopicos = $fachada->meusTopicos($_SESSION['login']);

                            foreach($meusTopicos as $mt) {

                                $forum = $mt['forum'];
                                $assunto = $mt['assunto'];
                                $topico = $mt['topico'];
                                $dataTopico = $mt['dataTopico'];
                                $qtdRespostas = $mt['qtdRespostas'];

                                echo "<tr>";
                                echo "<td><font size=\"3px\"><b>".$dataTopico."</b></font></td>";
                                echo "<td><font size=\"3px\"><b><a href='exibirTopico.php?forum=$forum&assunto=$assunto&topico=$topico'>".$topico."</a></b></font></td>";
                                echo "<td align='center'><font size=\"3px\"><b>".$qtdRespostas."</a></b></font></td>";
                                echo "</tr>";
                            }

                            ?>
                        </tr>
                    </table>
                </font>
            </form>
        </center>
    </body>
</html>

